package com.api.oa.services.impl;

import com.api.shopapi.entity.RetreatSettle;
import com.api.shopapi.mapper.RetreatSettleMapper;
import com.api.shopapi.service.RetreatSettleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("RetreatSettleServiceImplOne1")
public class RetreatSettleServiceImpl implements RetreatSettleService {

    @Autowired
    private RetreatSettleMapper retreatSettleMapper;

    @Override
    public int insert(RetreatSettle retreatSettle) {
        return  retreatSettleMapper.insert(retreatSettle);
    }

    @Override
    public PageInfo<RetreatSettle> getByInstitutionCode(int pageIndex, int pageSize, String institutionCode,String elderlyName) {
        PageHelper.startPage(pageIndex, pageSize);
        List<RetreatSettle> dishes = retreatSettleMapper.getByInstitutionCode(institutionCode,elderlyName);
        PageInfo<RetreatSettle> pageInfo = new PageInfo<>(dishes);
        return pageInfo;
    }

    @Override
    public double getSumTotal(String elderlyCode) {
        return retreatSettleMapper.getSumTotal(elderlyCode);
    }

    @Override
    public List<RetreatSettle> getByElderlyCode(String elderlyCode) {
        return retreatSettleMapper.getByElderlyCode(elderlyCode);
    }

    @Override
    public Object getSumTotalByInstitutionCode(String institutionCode) {
        return retreatSettleMapper.getSumTotalByInstitutionCode(institutionCode);
    }


}
